package demo3;

public class Computer {
    public void openComupter(){
        System.out.println("电脑开机");
    }

    public void offComputer(){
        System.out.println("电脑关机");
    }

    public void useUSB(Usb usb){
        usb.openDevice();
        if(usb instanceof Mouse) {
            Mouse mouse = (Mouse) usb;
            mouse.chick();
        }else if(usb instanceof KeyBoard) {
            KeyBoard keyBoard = (KeyBoard) usb;
            keyBoard.inPut();
        }
        usb.offDevice();
    }
}
